.class public Lcom/h2/org/springframework/beans/factory/ResourceResolver;
.super Ljava/lang/Object;
.source "ResourceResolver.java"


# static fields
.field public static final CLASSPATH:Ljava/lang/String; = "classpath"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 9
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method protected resolveClassPath(Ljava/lang/String;Z)Ljava/lang/String;
    .locals 6
    .parameter "path"
    .parameter "searchSubDirectories"

    .prologue
    .line 33
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;

    move-result-object v4

    const-string v5, ""

    invoke-virtual {v4, v5}, Ljava/lang/ClassLoader;->getResource(Ljava/lang/String;)Ljava/net/URL;

    move-result-object v4

    invoke-virtual {v4}, Ljava/net/URL;->getPath()Ljava/lang/String;

    move-result-object v1

    .line 34
    .local v1, path2:Ljava/lang/String;
    const/4 v2, 0x0

    .line 36
    .local v2, topDir:Ljava/io/File;
    :try_start_0
    new-instance v3, Ljava/io/File;

    const-string v4, "UTF-8"

    invoke-static {v1, v4}, Ljava/net/URLDecoder;->decode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .end local v2           #topDir:Ljava/io/File;
    .local v3, topDir:Ljava/io/File;
    move-object v2, v3

    .line 42
    .end local v3           #topDir:Ljava/io/File;
    .restart local v2       #topDir:Ljava/io/File;
    :goto_0
    const-string v4, "\\"

    invoke-virtual {p1, v4}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v4

    if-nez v4, :cond_0

    const-string v4, "/"

    invoke-virtual {p1, v4}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_1

    .line 43
    :cond_0
    const/4 v4, 0x1

    invoke-virtual {p1, v4}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object p1

    .line 45
    :cond_1
    invoke-virtual {p0, p1, v2, p2}, Lcom/h2/org/springframework/beans/factory/ResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/io/File;Z)Ljava/lang/String;

    move-result-object v4

    return-object v4

    .line 37
    :catch_0
    move-exception v0

    .line 39
    .local v0, exp:Ljava/io/UnsupportedEncodingException;
    invoke-virtual {v0}, Ljava/io/UnsupportedEncodingException;->printStackTrace()V

    goto :goto_0
.end method

.method protected resolveClassPathHelper(Ljava/lang/String;Ljava/io/File;Z)Ljava/lang/String;
    .locals 7
    .parameter "path"
    .parameter "topDir"
    .parameter "searchSubDirectories"

    .prologue
    .line 50
    invoke-virtual {p2}, Ljava/io/File;->listFiles()[Ljava/io/File;

    move-result-object v3

    .line 51
    .local v3, subDirs:[Ljava/io/File;
    new-instance v1, Lorg/springframework/util/AntPathMatcher;

    invoke-direct {v1}, Lorg/springframework/util/AntPathMatcher;-><init>()V

    .line 52
    .local v1, pathMatcher:Lorg/springframework/util/AntPathMatcher;
    const/4 v2, 0x0

    .line 53
    .local v2, result:Ljava/lang/String;
    array-length v5, v3

    const/4 v4, 0x0

    :goto_0
    if-lt v4, v5, :cond_1

    :cond_0
    move-object v4, v2

    .line 68
    :goto_1
    return-object v4

    .line 53
    :cond_1
    aget-object v0, v3, v4

    .line 54
    .local v0, file:Ljava/io/File;
    invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v1, p1, v6}, Lorg/springframework/util/AntPathMatcher;->matchStart(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_2

    .line 55
    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v2

    .line 56
    invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z

    move-result v6

    if-eqz v6, :cond_3

    .line 57
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v5, "\\"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    goto :goto_1

    .line 60
    :cond_2
    invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z

    move-result v6

    if-eqz v6, :cond_3

    if-eqz p3, :cond_3

    .line 61
    invoke-virtual {p0, p1, v0, p3}, Lcom/h2/org/springframework/beans/factory/ResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/io/File;Z)Ljava/lang/String;

    move-result-object v2

    .line 64
    :cond_3
    if-nez v2, :cond_0

    .line 53
    add-int/lit8 v4, v4, 0x1

    goto :goto_0
.end method

.method public resolvePath(Ljava/lang/String;)Ljava/lang/String;
    .locals 2
    .parameter "path"

    .prologue
    .line 18
    const-string v0, "classpath"

    invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 19
    const-string v0, "classpath*:"

    invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 21
    const-string v0, "classpath*:"

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    invoke-virtual {p1, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x1

    .line 20
    invoke-virtual {p0, v0, v1}, Lcom/h2/org/springframework/beans/factory/ResourceResolver;->resolveClassPath(Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object p1

    .line 28
    .end local p1
    :cond_0
    :goto_0
    return-object p1

    .line 23
    .restart local p1
    :cond_1
    const-string v0, "classpath:"

    invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 25
    const-string v0, "classpath:"

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    invoke-virtual {p1, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    .line 24
    invoke-virtual {p0, v0, v1}, Lcom/h2/org/springframework/beans/factory/ResourceResolver;->resolveClassPath(Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object p1

    goto :goto_0
.end method
